<template>
  <div class="dashboard-editor-container">
    <!-- <github-corner class="github-corner" /> -->
    <panel-group @handleSetLineChartData="handleSetLineChartData" :count-data='this.count' />
    <el-row style="background: #fff; padding: 16px 16px 0; margin-bottom: 32px"  class="char">
    <!-- <line-chart :chart-data="lineChartData" /> -->
    <div class="charsHeart" style="padding-left:20px">
      <span></span>
      <p>数据的实时访问量</p>
    </div>
       <el-row :gutter="8">
        <el-col :xs="24" :sm="24" :lg="16">
          <div class="chart-wrapper">
            <bar-chart  :data-series="this.AllData"/>
          </div>
        </el-col>
        <el-col
          :xs="{ span: 24 }"
          :sm="{ span: 12 }"
          :md="{ span: 12 }"
          :lg="{ span: 8 }"
          :xl="{ span: 6 }"
          style="margin-top: -20px;"
        >
        
          <box-card :sum-data="this.AllData.key_visit_count" />
        </el-col>
      </el-row> 
     </el-row> 
 <el-row :gutter="32">
      <el-col :xs="24" :sm="24" :lg="12">
        <div class="chart-wrapper char"  style="padding-top:10px">
           <div style="height: 10px"></div>
          <div>
            <span class="Blueline"></span>
            <span style="color:#a8a8a8;line-height: 18px;height:18px;padding-top: 1px;">   违规使用数据的用户报警 </span>  </div>
          <!-- <div style="height: 10px"></div> -->
        <transaction-table :top5="this.AllData.key_visit_by_user_top5" :tabletitle="this.title" />
        </div>
      </el-col>
      <el-col :xs="24" :sm="24" :lg="12">
        <div class="chart-wrapper char"  style="padding-top:10px">
           <div style="height: 10px"></div>
          <div>
            <span class="Blueline"></span>
            <span style="color:#a8a8a8;line-height: 18px;height:18px;padding-top: 1px;">   违规使用数据的系统报警 </span>  </div>
          <!-- <div style="height: 10px"></div> -->
          <transaction-table  :top5="this.AllData.key_visit_by_site_top5" :tabletitle="this.title1"/>
        </div>
      </el-col>
    </el-row>


    <el-row :gutter="32">
      <el-col :xs="24" :sm="24" :lg="8" v-for="(item,index) in this.AllData.key_visit_by_site_detail" :key="index">
        <div class="chart-wrapper char" style="padding-top:10px">
           <div style="height: 10px"></div>
          <div>
            <span class="Blueline"></span>
            <span style="color:#a8a8a8;line-height: 18px;height:18px;padding-top: 1px;">   数据热力图 -{{ item.site }}</span>  </div>
          <div style="height: 20px"></div>
          <bar-charts   />
        </div>
      </el-col>
    </el-row>


     <el-row :gutter="32">
      <el-col :xs="24" :sm="24" :lg="12">
        <div class="chart-wrapper char"  style="padding-top:10px">
           <div style="height: 10px"></div>
          <div>
            <span class="Blueline"></span>
            <span style="color:#a8a8a8;line-height: 18px;height:18px;padding-top: 1px;">   数据访问量TOP用户 </span>  </div>
          <div style="height: 20px"></div>
        <raddar-chart />
        </div>
      </el-col>
      <el-col :xs="24" :sm="24" :lg="12">
        <div class="chart-wrapper char"  style="padding-top:10px">
           <div style="height: 10px"></div>
          <div>
            <span class="Blueline"></span>
            <span style="color:#a8a8a8;line-height: 18px;height:18px;padding-top: 1px;">  数据访问量TOP系统 </span>  </div>
          <div style="height: 20px"></div>
            <pie-chart />
        </div>
      </el-col>
    </el-row>



  </div>
</template>

<script>
// import GithubCorner from "@/components/GithubCorner";
import PanelGroup from "./components/PanelGroup";
import LineChart from "./components/LineChart";
import RaddarChart from "./components/RaddarChart";
import PieChart from "./components/PieChart";
import BarChart from "./components/BarChart";
import BarCharts from "./components/BarCharts";
import TransactionTable from "./components/TransactionTable";
import TodoList from "./components/TodoList";
import BoxCard from "./components/BoxCard";
import { fetchList } from "@/api/panel";

const lineChartData = {
  newVisitis: {
    expectedData: [100, 120, 161, 134, 105, 160, 165],
    actualData: [120, 82, 91, 154, 162, 140, 145],
  },
  messages: {
    expectedData: [200, 192, 120, 144, 160, 130, 140],
    actualData: [180, 160, 151, 106, 145, 150, 130],
  },
  purchases: {
    expectedData: [80, 100, 121, 104, 105, 90, 100],
    actualData: [120, 90, 100, 138, 142, 130, 130],
  },
  shoppings: {
    expectedData: [130, 140, 141, 142, 145, 150, 160],
    actualData: [120, 82, 91, 154, 162, 140, 130],
  },
};

export default {
  name: "DashboardAdmin",
  components: {
    // GithubCorner,
    PanelGroup,
    // LineChart,
    RaddarChart,
    PieChart,
    BarChart,
    TransactionTable,
    TodoList,
    BoxCard,
    BarCharts
  },
  data() {
    return {
      title: "用户名",
      title1: '系统名称',
      lineChartData: lineChartData.newVisitis,
      count:{
      site_count:'',
      online_terminal:'',
      total_visit_count:'',
      all_user:'',
      },
      AllData:{

      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    handleSetLineChartData(type) {
      this.lineChartData = lineChartData[type];
    },
     getList() {
        fetchList().then(response => {
          this.count.site_count = response.data.site_count
          this.count.online_terminal = response.data.online_terminal
          this.count.total_visit_count = response.data.total_visit_count
          this.count.all_user = response.data.all_user
          this.AllData = response.data
          // console.log(this.count)  
        })
      },
  },
};
</script>

<style lang="scss" scoped>
.newStyle{
    border-radius: 15px !important;
  box-shadow: 1px  2px  10px   rgba(0, 0, 0,0.3);
}
.dashboard-editor-container {
  padding: 32px;
  background-color: rgb(240, 242, 245);
  position: relative;

  .github-corner {
    position: absolute;
    top: 0px;
    border: 0;
    right: 0;
  }

  .chart-wrapper {
    background: #fff;
    padding: 16px 16px 0;
    margin-bottom: 32px;
  }
}

@media (max-width: 1024px) {
  .chart-wrapper {
    padding: 8px;
  }
}
@media only screen and (min-width: 1920px){
  .el-col-xl-12 {
    width: 49%;
  }
}
.char{
  // background-color: red !important;
  border-radius: 15px !important;
  box-shadow: 1px  2px  10px   rgba(0, 0, 0,0.3);
}
.charsHeart {
  width: 100%;
  // height: 40px;
  // background-color: red;
  // text-align: center;
  // line-height: 40px;
 
}
.charsHeart span{
  display: inline-block;
  margin: 0 10px 0;
  width: 5px;
  height: 24px;
  vertical-align: middle;
  background-color: rgb(24,144,255);
}
.charsHeart p{
  font-size: 24px;
  color: rgb(168,168,168);
  display:inline-block;
  vertical-align: middle; 
}
// .cardFather {
//   display: flex;
//   justify-content: space-between;
// }
.callThePolice {
  float: left;
  background-color: #fff;
  border-radius: 10px;
  padding: 16px 30px !important;
  box-sizing: border-box;
  box-shadow: 1px  2px  10px   rgba(0, 0, 0,0.3);
}
.callThePolice:nth-child(2){
  float: right;
}
.callThePolice p{
  margin: 0px 10px 0;
  display: inline-block;
  vertical-align: middle;
  font-size: 25px;
  color: #a8a8a8;
  vertical-align: middle;

}
.callThePolice  span {
  display: inline-block;
  width: 5px;
  height: 24px;
  vertical-align: middle;
  background-color: rgb(24,144,255);
}
.Blueline{
  display: inline-block;
  width: 5px;
  height: 18px;
  vertical-align: middle;
  background-color: rgb(24,144,255);
  margin-right: 6px;
}
</style>
